﻿package view.component
{
    import __AS3__.vec.*;
    import com.core.*;
    import com.greensock.*;
    import flash.display.*;
    import flash.utils.*;

    public class Horn extends Sprite
    {
        private var row:int = 3;
        private var curRow:int = 0;
        private var times:int = 1;
        private var hornDic:Dictionary;
        private var txtVec:Vector.<Object>;

        public function Horn()
        {
            this.hornDic = new Dictionary();
            this.txtVec = new Vector.<Object>;
            return;
        }// end function

        public function addHorn(param1:Object) : void
        {
            this.txtVec.push(param1);
            this.doShow();
            return;
        }// end function

        private function doShow() : void
        {
            var _loc_3:HornItem = null;
            var _loc_4:Number = NaN;
            if (this.curRow >= this.row)
            {
                return;
            }
            if (this.txtVec.length <= 0)
            {
                return;
            }
            var _loc_5:String = this;
            var _loc_6:* = this.curRow + 1;
            _loc_5.curRow = _loc_6;
            ModelProxy.change("data", "promptRow", this.curRow);
            ModelProxy.change("mainui", "changePromptPos", this.curRow);
            var _loc_1:* = this.txtVec.shift();
            var _loc_2:* = new HornItem(_loc_1, this.times, this.doComp);
            this.addChild(_loc_2);
            _loc_2.alpha = 0;
            TweenLite.to(_loc_2, 1, {alpha:1});
            for each (_loc_3 in this.hornDic)
            {
                
                _loc_4 = _loc_3.y / 31;
                TweenLite.to(_loc_3, 0.6, {y:_loc_4 > 0 ? (Math.ceil(_loc_4)) : (Math.floor(_loc_4) * 31 - 31)});
            }
            this.hornDic[_loc_2] = _loc_2;
            return;
        }// end function

        public function doComp(param1:HornItem) : void
        {
            var _loc_2:HornItem = null;
            var _loc_3:Number = NaN;
            delete this.hornDic[param1];
            for each (_loc_2 in this.hornDic)
            {
                
                if (_loc_2.y < param1.y)
                {
                    _loc_3 = _loc_2.y / 31;
                    TweenLite.to(_loc_2, 0.6, {y:_loc_3 > 0 ? (Math.ceil(_loc_3)) : (Math.floor(_loc_3) * 31 + 31)});
                }
            }
            param1.removeShow();
            var _loc_4:String = this;
            var _loc_5:* = this.curRow - 1;
            _loc_4.curRow = _loc_5;
            ModelProxy.change("data", "promptRow", this.curRow);
            ModelProxy.change("mainui", "changePromptPos", this.curRow);
            this.doShow();
            return;
        }// end function

    }
}
